#ifndef OBJECTVIEW_H
#define OBJECTVIEW_H

#include <QTreeWidget>
#include <QItemDelegate>

class AbstractObject;

class ObjectItem : public QTreeWidgetItem
{
public:
    QPointer<AbstractObject> m_object;
};

class ObjectView : public QTreeWidget
{
    Q_OBJECT
public:
    explicit ObjectView(QWidget *parent = 0);
    
private:
    void contextMenuEvent(QContextMenuEvent *pEvent);
    void keyPressEvent(QKeyEvent *event);
    void mouseDoubleClickEvent(QMouseEvent *event);
signals:
    void objectSelectionChanged(QPointer<AbstractObject> object);
public slots:
    void onObjectCreated(QPointer<AbstractObject> object);
    void onObjectDeleted(QPointer<AbstractObject> object);
    void selectObject(QPointer<AbstractObject> object);
private slots:
    void onItemSelectionChanged();
    void onItemChanged(QTreeWidgetItem *item, int column);
};

#endif // OBJECTVIEW_H
